package com.klangner.go.model.impl;

import junit.framework.TestCase;

import com.klangner.go.model.IBoard;
import com.klangner.go.model.impl.GoBoard;


public class GoBoardTest extends TestCase{

	/**
	 * make copy
	 */
	public void testMakeCopy() {
		IBoard board = new GoBoard(9);
		IBoard copy;
		
		board.setStone(1, 1, IBoard.BLACK_STONE);
		copy = board.makeCopy();
		
		assertEquals(IBoard.BLACK_STONE, copy.getStone(1, 1));
	}
	
	/**
	 * ..x..
	 * .xoo.
	 * ..x..
	 */
	public void testGroups() {
		IBoard 		board = new GoBoard(9);
		
		board.setStone(2, 1, IBoard.BLACK_STONE);
		board.setStone(2, 3, IBoard.BLACK_STONE);
		board.setStone(1, 2, IBoard.BLACK_STONE);
		board.setStone(3, 2, IBoard.WHITE_STONE);
		board.setStone(2, 2, IBoard.WHITE_STONE);

		assertEquals(3, board.getGroups(IBoard.BLACK_STONE).size());
		assertEquals(1, board.getGroups(IBoard.WHITE_STONE).size());
	}
	
	
}
